package com.kly.sc.api.application.controller.user.request;

import com.fqgj.common.api.ParamsObject;
import com.kly.sc.api.infras.enums.RestCodeEnum;
import com.kly.sc.api.infras.exception.ApplicationException;
import org.apache.commons.lang3.StringUtils;

import java.util.Objects;

/**
 * 用户照片
 * @author linqu
 */
public class AddImagesRequest extends ParamsObject {


    /**
     * 照片内码
     */
    private String imageCode;
    /**
     * 照片
     */
    private String imageUrl;
    /**
     * 相册类型
     */
    private Integer type;
    /**
     * 视频长度，添加照片该字段无值
     */
    private Integer videoLength;


    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public String getImageCode() {
        return imageCode;
    }

    public void setImageCode(String imageCode) {
        this.imageCode = imageCode;
    }

    public String getImageUrl() {
        return imageUrl;
    }

    public void setImageUrl(String imageUrl) {
        this.imageUrl = imageUrl;
    }

    public Integer getVideoLength() {
        return videoLength;
    }

    public void setVideoLength(Integer videoLength) {
        this.videoLength = videoLength;
    }

    @Override
    public void validate() {

        if (Objects.isNull(this.type)) {
            throw new ApplicationException(RestCodeEnum.SYSTEM_PARAMETER_ERROR);
        }
        if (Objects.isNull(this.imageUrl)) {
            throw new ApplicationException("The image should not be empty");
        }

    }
}
